/* Code Pulse: a real-time code coverage tool, for more information, see <http://code-pulse.com/>
 *
 * Copyright (C) 2014-2017 Code Dx, Inc. <https://codedx.com/>
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.codedx.codepulse.agent.common.config;

import java.io.Serializable;
import java.util.List;

import com.codedx.codepulse.agent.common.util.StringUtil;

import javax.json.bind.annotation.JsonbCreator;
import javax.json.bind.annotation.JsonbProperty;

public class RuntimeAgentConfigurationV1 implements Serializable
{
	/**
	 * This number was auto-generated by Eclipse.
	 */
	private static final long serialVersionUID = -4660117618158655806L;

	private final byte runId;
	private final int heartbeatInterval;
	private final List<String> exclusions;
	private final List<String> inclusions;
	private final int bufferMemoryBudget;
	private final int queueRetryCount;
	private final int numDataSenders;

	@JsonbCreator
	public RuntimeAgentConfigurationV1(@JsonbProperty("runId") byte runId,
									   @JsonbProperty("heartbeatInterval") int heartbeatInterval,
									   @JsonbProperty("exclusions") List<String> exclusions,
									   @JsonbProperty("inclusions") List<String> inclusions,
									   @JsonbProperty("bufferMemoryBudget") int bufferMemoryBudget,
									   @JsonbProperty("queueRetryCount") int queueRetryCount,
									   @JsonbProperty("numDataSenders") int numDataSenders)
	{
		this.runId = runId;
		this.heartbeatInterval = heartbeatInterval;
		this.exclusions = exclusions;
		this.inclusions = inclusions;
		this.bufferMemoryBudget = bufferMemoryBudget;
		this.queueRetryCount = queueRetryCount;
		this.numDataSenders = numDataSenders;
	}

	@Override
	public String toString()
	{
		StringBuilder sb = new StringBuilder("AgentConfiguration( id=");
		sb.append(runId).append(", heartbeatInterval=");
		sb.append(heartbeatInterval).append(", excludes=");
		sb.append(StringUtil.mkString(exclusions, "[", ", ", "]"));
		sb.append(", includes=");
		sb.append(StringUtil.mkString(inclusions, "[", ", ", "]"));
		sb.append(", bufferMemoryBudget=").append(bufferMemoryBudget);
		sb.append(", queueRetryCount=").append(queueRetryCount);
		sb.append(", numDataSenders=").append(numDataSenders);
		sb.append(")");
		return sb.toString();
	}

	public byte getRunId()
	{
		return runId;
	}

	public int getHeartbeatInterval()
	{
		return heartbeatInterval;
	}

	public List<String> getExclusions()
	{
		return exclusions;
	}

	public List<String> getInclusions()
	{
		return inclusions;
	}

	public int getBufferMemoryBudget()
	{
		return bufferMemoryBudget;
	}

	public int getQueueRetryCount()
	{
		return queueRetryCount;
	}

	public int getNumDataSenders()
	{
		return numDataSenders;
	}

}
